{{- if .Values.service.ssl.enabled }}
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: {{ include "app.fullname" . }}
  namespace: istio-system
spec:
  secretName: {{ include "app.fullname" . }}
  commonName: {{ .Values.service.host }}
  duration: 2160h0m0s # 90d
  renewBefore: 360h0m0s # 15d
  subject:
    organizations:
      - DevMiner.xyz
  privateKey:
    algorithm: RSA
    encoding: PKCS1
    size: 4096
  usages:
    - server auth
    - client auth
  dnsNames:
    - {{ .Values.service.host }}
    - www.{{ .Values.service.host }}
  issuerRef:
    name: {{ .Values.service.ssl.issuer.name }}
    kind: {{ .Values.service.ssl.issuer.kind }}
{{- end }}
